# -*- coding: utf-8 -*-

# Autor: Pedro Godinho, n.º 6355
# Data: 08/12/2011

import SimpleHTTPServer
import SocketServer
from KThread import *

class Servidor(threading.Thread):
    '''
    Esta classe cria um servidor Html, que funciona na Porta 6355
    '''
    
    def iniciarServidor(self):
        self.server = KThread(target=self.start_thread)
        self.server.start()
        pass
    pass

    def start_thread(self):
        PORT = 6355                     # porta usada pelo servidor
        
        Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
        httpd = SocketServer.TCPServer(('', PORT), Handler)
        
        print "Servidor HTTP na porta", PORT
        httpd.serve_forever()
        pass
    pass
    
